package homeworkplus.day02;

import java.util.Scanner;

/**
 * @Classname: Test07
 * @Author: bromide
 * @CreateTime: 2022/3/30--8:57
 * @Version: V1.0
 * @Desciption: 输入一个数学计算表达式，如:1+2
 * 然后输出计算后的结果:1+2=3
 * 这里计算表达式只计算一次即可，可以使用加减乘除任意一个,可以进行小数运算。
 */
public class Test07 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String math = scanner.nextLine();
        String[] numbers = new String[2];
        float sum = 0L;
        if (math.contains("+")) {
            numbers = math.split("\\+");
            sum = Float.parseFloat(numbers[0]) + Float.parseFloat(numbers[1]);
        } else if (math.contains("-")) {
            numbers = math.split("\\-");
            sum = Float.parseFloat(numbers[0]) - Float.parseFloat(numbers[1]);
        } else if (math.contains("*")) {
            numbers = math.split("\\*");
            sum = Float.parseFloat(numbers[0]) * Float.parseFloat(numbers[1]);
        } else if (math.contains("/")) {
            numbers = math.split("\\/");
            sum = Float.parseFloat(numbers[0]) / Float.parseFloat(numbers[1]);
        } else {
            System.out.println("输入错误");
        }
        System.out.println(math + "=" + sum);
    }
}